<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        .blue {
            background: blue;
        }

        .red {
            background: red;
        }
    </style>
</head>

<body>
    <div id="app">
        <ul>
            <li :class="{blue:flag1,red:!flag1}">
                <span v-if="flag1">对</span>
                <span v-else>错</span>
            </li>
            <li :class="{blue:flag2,red:!flag2}">
                <span v-if="flag2">对</span>
                <span v-else>错</span>
            </li>
        </ul>
    </div>

    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                flag1: true,
                flag2: false
            },
            methods: {}
        });
    </script>
</body>

</html>